#include<stdio.h>
int main()
{
    int a,b=0,c=0;
    scanf("%d",&a);
    while(a>2==1)
    {b=a/3+b;
    c=a%3;
    a=a/3+c;}
    (a!=2)?printf("%d",b):printf("%d",b+1);
    return 0;
}
